package cn.itsource.pet.mapper;

import cn.itsource.pet.domain.Pet;
import cn.itsource.pet.query.PetQuery;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * spring生成代理mapper实现
 *
 * Mapper映射器
 */
public interface PetMapper extends Mapper<Pet> {

    List<Pet> findPage();

    Pet findOne(Long id);

    default List<Pet> queryHomePage(PetQuery petQuery){
        //1.封装查询条件
        Example example = new Example(Pet.class);

        example.and().andEqualTo("state",1);

        //2.查询
        return this.selectByExample(example);
    }


    Pet detailById(Long id);
}

